import {request} from "@/api";
import {LoginResp, LoginUser} from "@/api/auth/types.ts";

const apiPrefix = '/varian-auth'
export const authApi = {
    token: (data: any) => request.post<LoginResp>(`${apiPrefix}/oauth2/token`, {
        data,
        auth: {username: import.meta.env.VITE_APP_CLIENT_ID, password: import.meta.env.VITE_APP_CLIENT_SECRET}
    }),
    captcha: (params: any) => request.get<string>(`${apiPrefix}/oauth2/captcha`, {params}),
    userInfo: () => request.get<LoginUser>(`${apiPrefix}/oauth2/user-info`)
}
